package cn.ym.mall.service.impl;

import cn.ym.mall.dao.ProvinceDao;
import cn.ym.mall.dao.impl.ProvinceDaoImpl;
import cn.ym.mall.entity.Activity;
import cn.ym.mall.entity.Province;
import cn.ym.mall.service.ProvinceService;
import cn.ym.mall.utils.DruidUtils;

import java.sql.Connection;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;

/**
 * @author 漆家乐
 */
public class ProvinceServiceImpl implements ProvinceService {
    ProvinceDao provinceDao = new ProvinceDaoImpl();
    /**
     * 查询所有省份
     *
     * @return
     * @throws SQLException
     */
    @Override
    public List<Province> getProvince() throws SQLException {
        Connection conn = null;
        List<Province> provinceList = new ArrayList<>();
        try {
            conn = DruidUtils.getConnection();
            provinceList = provinceDao.getProvince();
        } catch (Exception e) {
            e.printStackTrace();
        } finally {
            DruidUtils.close();
        }
        return provinceList;
    }
}
